home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 December / PCWorld_2003-12_cd.bin / Software / Vyzkuste / saproxy / SAproxyInstaller.exe / {app} / rules / 20_compensate.cf < prev    next >
Text File  |  2003-03-17  |  13KB  |  289 lines

  1. # SpamAssassin rules file: compensation for common false positives
  2. #
  3. # Please don't modify this file as your changes will be overwritten with
  4. # the next update. Use @@LOCAL_RULES_DIR@@/local.cf instead.
  5. # See 'perldoc Mail::SpamAssassin::Conf' for details.
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of either the Artistic License or the GNU General
  9. # Public License as published by the Free Software Foundation; either
  10. # version 1 of the License, or (at your option) any later version.
  11. #
  12. # See the file "License" in the top level of the SpamAssassin source
  13. # distribution for more details.
  14. #
  15. ###########################################################################
  16. # Header compensation tests
  17. #
  18. # Note: HTML compensation tests are in 20_body_tests.cf
  19.  
  20. require_version @@VERSION@@
  21.  
  22. # support for Habeas sender-warranted email: http://www.habeas.com/
  23. header HABEAS_SWE               eval:message_is_habeas_swe()
  24. describe HABEAS_SWE             Uses the Habeas warrant mark (http://www.habeas.com/)
  25. tflags HABEAS_SWE               nice
  26.  
  27. header GENUINE_EBAY_RCVD        eval:check_for_from_domain_in_received_headers('ebay.com', 'true')
  28. describe GENUINE_EBAY_RCVD      Message from eBay
  29. tflags GENUINE_EBAY_RCVD    nice
  30.  
  31. header   APPROVED_BY            exists:Approved-By
  32. describe APPROVED_BY            Has an Approved-By moderated list header
  33. tflags APPROVED_BY        nice
  34.  
  35.  
  36. # This is a Bugzilla bug status report e-mail and probably OK
  37. header BUGZILLA_BUG             eval:message_from_bugzilla()
  38. describe BUGZILLA_BUG           Looks like a Bugzilla bug
  39. tflags BUGZILLA_BUG        nice
  40.  
  41. header DEBIAN_BTS_BUG           eval:message_from_debian_bts()
  42. describe DEBIAN_BTS_BUG         Looks like a Debian BTS bug
  43. tflags DEBIAN_BTS_BUG        nice
  44.  
  45. # give a negative score to Majordomo results.
  46. header   MAJORDOMO              Subject =~ /Majordomo (?:request )?results/
  47. describe MAJORDOMO              From Majordomo
  48. tflags MAJORDOMO        nice
  49.  
  50. header REFERENCES        References =~ /^(<(?:[a-zA-Z0-9.!\#\$%&'*\+\/=?\^_{}|~-]+|\".+\")\@(?:[a-zA-Z0-9.-]+|\[\d{1,3}(?:\.\d{1,3}){3}\])>\s*)+$/
  51. describe REFERENCES        Has a valid-looking References header
  52. tflags REFERENCES               nice
  53.  
  54. # User-Agent isn't usually found with spam, but ignore it if we already account with a compensate rule
  55. header __USER_AGENT        exists:User-Agent
  56. meta USER_AGENT            ( __USER_AGENT && !USER_AGENT_PINE && !USER_AGENT_MUTT && !USER_AGENT_MOZILLA_UA && !USER_AGENT_MOZILLA_XM && !USER_AGENT_MACOE && !USER_AGENT_ENTOURAGE && !USER_AGENT_KMAIL && !USER_AGENT_IMP && !USER_AGENT_TONLINE && !USER_AGENT_APPLEMAIL && !USER_AGENT_GNUS_UA && !USER_AGENT_GNUS_XM && !USER_AGENT_VM && !USER_AGENT_MSN && !USER_AGENT_FORTE && !USER_AGENT_XIMIAN )
  57. describe USER_AGENT        Has a User-Agent header
  58. tflags USER_AGENT               nice
  59.  
  60. # these headers have very low correlation with spam
  61. header CRON_ENV                 exists:X-Cron-Env
  62. header IN_REP_TO                exists:In-Reply-To
  63. header X_AUTH_WARNING           exists:X-Authentication-Warning
  64. header X_MAILING_LIST           exists:X-Mailing-List
  65. header X_LOOP                   exists:X-Loop
  66. header X_ACCEPT_LANG            exists:X-Accept-Language
  67. header RESENT_TO                exists:Resent-To
  68. describe CRON_ENV        Has a X-Cron-Env header
  69. describe IN_REP_TO        Has a In-Reply-To header
  70. describe X_AUTH_WARNING        Has a X-Authentication-Warning header
  71. describe X_MAILING_LIST        Has a X-Mailing-List header
  72. describe X_LOOP            Has a X-Loop header
  73. describe X_ACCEPT_LANG        Has a X-Accept-Language  header
  74. describe RESENT_TO        Has a Resent-To header
  75. tflags CRON_ENV                 nice
  76. tflags IN_REP_TO                nice
  77. tflags X_AUTH_WARNING           nice
  78. tflags X_MAILING_LIST           nice
  79. tflags X_LOOP                   nice
  80. tflags X_ACCEPT_LANG            nice
  81. tflags RESENT_TO                nice
  82.  
  83. # came from a known mailing list system -- but one which does *not* have built-in
  84. # (or working!) spam filtering.
  85. header   KNOWN_MAILING_LIST     eval:detect_mailing_list()
  86. describe KNOWN_MAILING_LIST     Email came from some known mailing list software
  87. tflags KNOWN_MAILING_LIST    nice
  88.  
  89. # from Theo Van Dinter, see http://www.hughes-family.org/bugzilla/show_bug.cgi?id=591
  90. body MSN_GROUPS                 eval:check_for_msn_groups_headers()
  91. describe MSN_GROUPS             Came from MSN Communities
  92. tflags MSN_GROUPS               nice
  93.  
  94. # some non-spam rules from http://www.darkmere.gen.nz/2002/0628.html
  95. header Q_FOR_SELLER             Subject =~ /Question.*(?:for|to|from eBay).*(?:seller|Member)/
  96. describe Q_FOR_SELLER           Subject is an eBay question
  97. tflags Q_FOR_SELLER        nice
  98.  
  99. header SUBJECT_IS_IN_REVIEW     Subject =~ /\bin review\b/i
  100. describe SUBJECT_IS_IN_REVIEW   Subject contains newsletter header (in review)
  101. tflags SUBJECT_IS_IN_REVIEW    nice
  102.  
  103. header FROM_EGROUPS             X-eGroups-Return =~ /^sentto-.*\@returns\.groups\.yahoo\.com$/
  104. describe FROM_EGROUPS           Appears to be from yahoo groups
  105. tflags FROM_EGROUPS        nice
  106.  
  107. # compensate for common false pos on above rule: Yahoo! webmail
  108. header YAHOO_MSGID_ADDED        ALL =~ /Message-Id: <\S+\.mail\.yahoo\.com>\nReceived: .*by \S+mail\.yahoo\.com via HTTP;/s
  109. describe YAHOO_MSGID_ADDED      'Message-Id' was added by yahoo.com, that's OK
  110. tflags YAHOO_MSGID_ADDED        nice
  111.  
  112. ###########################################################################
  113. # Body compensation tests
  114. ###########################################################################
  115.  
  116. body HOTMAIL_FOOTER1             /Send and receive Hotmail on your mobile device\b/
  117. describe HOTMAIL_FOOTER1        Common footer for Hotmail
  118. tflags HOTMAIL_FOOTER1        nice
  119.  
  120. body HOTMAIL_FOOTER2            /Get your FREE download of MSN Explorer at\b/
  121. describe HOTMAIL_FOOTER2        Common footer for Hotmail
  122. tflags HOTMAIL_FOOTER2        nice
  123.  
  124. body HOTMAIL_FOOTER3            /Get Your Private, Free E-mail from MSN Hotmail at http:\/\/www\.hotmail\.com\./
  125. describe HOTMAIL_FOOTER3        Common footer for Hotmail
  126. tflags HOTMAIL_FOOTER3        nice
  127.  
  128. body HOTMAIL_FOOTER5            /Chat with friends online, try MSN Messenger\b/
  129. describe HOTMAIL_FOOTER5        Common footer for Hotmail
  130. tflags HOTMAIL_FOOTER5        nice
  131.  
  132. body MSN_FOOTER1                /MSN Photos is the easiest way to share and print your photos\b/
  133. describe MSN_FOOTER1            Common footer for MSN
  134. tflags MSN_FOOTER1        nice
  135.  
  136. body GROUPS_YAHOO_1             /^Your use of Yahoo! Groups is subject to http:\/\/\Qdocs.yahoo.com\E\/info\/terms\//
  137. describe GROUPS_YAHOO_1         Yahoo! Groups message
  138. tflags GROUPS_YAHOO_1        nice
  139.  
  140. # signature tests
  141. full SIGNATURE_SHORT_DENSE    eval:check_signature('1', '7', '0')
  142. describe SIGNATURE_SHORT_DENSE    Short signature present (no empty lines)
  143. tflags SIGNATURE_SHORT_DENSE    nice
  144.  
  145. full SIGNATURE_SHORT_SPARSE    eval:check_signature('1', '7', '1')
  146. describe SIGNATURE_SHORT_SPARSE    Short signature present (empty lines)
  147. tflags SIGNATURE_SHORT_SPARSE    nice
  148.  
  149. full SIGNATURE_LONG_DENSE    eval:check_signature('8', '15', '0')
  150. describe SIGNATURE_LONG_DENSE    Long signature present (no empty lines)
  151. tflags SIGNATURE_LONG_DENSE    nice
  152.  
  153. full SIGNATURE_LONG_SPARSE    eval:check_signature('8', '15', '1')
  154. describe SIGNATURE_LONG_SPARSE    Long signature present (empty lines)
  155. tflags SIGNATURE_LONG_SPARSE    nice
  156.  
  157. body MAILMAN_CONFIRM            /^We have received a request from \S+ for subscription of your email address, \S+, to the \S+ mailing list\./
  158. describe MAILMAN_CONFIRM        A MailMan confirm-your-address message
  159. tflags MAILMAN_CONFIRM        nice
  160.  
  161. rawbody __PGP_BEGIN        /^-----BEGIN PGP SIGNATURE-----$/
  162. rawbody __PGP_MIDDLE        /^[0-9A-Za-z+\/]{64}$/
  163. rawbody __PGP_END        /^-----END PGP SIGNATURE-----$/
  164. meta PGP_SIGNATURE        (__PGP_BEGIN && __PGP_MIDDLE && __PGP_END)
  165. describe PGP_SIGNATURE        Contains a PGP-signed message
  166. tflags PGP_SIGNATURE        nice
  167.  
  168. header PGP_SIGNATURE_2        Content-Type =~ /protocol=.?application\/pgp-signature.?;/i
  169. describe PGP_SIGNATURE_2    Contains a PGP-signed message (signature attached)
  170. tflags PGP_SIGNATURE_2        nice
  171.  
  172. header __SMIME_SIGNED_HDR       Content-Type =~ /multipart\/signed;.*protocol=/i
  173. full __SMIME_SIGNED_BODY        /\nContent-Type: application\/x-pkcs7-signature;/
  174. meta SMIME_SIGNATURE            (__SMIME_SIGNED_HDR && __SMIME_SIGNED_BODY)
  175. describe SMIME_SIGNATURE        Contains an S/MIME-signed message
  176. tflags SMIME_SIGNATURE          nice
  177.  
  178. rawbody PATCH_UNIFIED_DIFF    /^\@\@ [-+0-9]+,[0-9]+ [-+0-9]+,[0-9]+ \@\@$/
  179. describe PATCH_UNIFIED_DIFF    Contains what looks like a patch from diff -u
  180. tflags PATCH_UNIFIED_DIFF    nice
  181.  
  182. rawbody PATCH_CONTEXT_DIFF    /^\*{3} \S+\s+.{10,}\b\d{2}:\d{2}:\d{2}\s/
  183. describe PATCH_CONTEXT_DIFF    Contains what looks like a patch from diff -c
  184. tflags PATCH_CONTEXT_DIFF    nice
  185.  
  186. body DISCLAIMER_LEGALESE        /This e?-?mail.{1,20}confidential.{1,20}legally privileged/i
  187. describe DISCLAIMER_LEGALESE    Contains what looks like an 'E-Mail Disclaimer'
  188. tflags DISCLAIMER_LEGALESE    nice
  189.  
  190. # The regexp begins with "(?:\"|--- )?" because, in addition to
  191. # possibly begining with a double quote, it might also begin with
  192. # "--- ", which is used by the Yahoo! groups web form when
  193. # doing attribution.
  194. #
  195. # The regexp ends with "\s*(?:$|>)" rather than "$" because, by
  196. # the time the "body" tests are done, this:
  197. #
  198. #   foo@bar.com writes:
  199. #   > blah blah blah
  200. #
  201. # becomes
  202. #
  203. #   foo@bar.com writes: > blah blah blah
  204. #
  205. body EMAIL_ATTRIBUTION          /^(?:\"|--- )?\w.{4,80} (?:wrote|writes):\s*(?:$|>)/
  206. describe EMAIL_ATTRIBUTION    Contains what looks like an email attribution
  207. tflags EMAIL_ATTRIBUTION    nice
  208.  
  209. rawbody QUOTED_EMAIL_TEXT       /^>+\s+.{60,72}$/
  210. describe QUOTED_EMAIL_TEXT    Contains what looks like a quoted email text
  211. tflags QUOTED_EMAIL_TEXT    nice
  212.  
  213. body QUOTE_TWICE_1              /^> >\s/
  214. describe QUOTE_TWICE_1          Contains twice quoted reply
  215. tflags QUOTE_TWICE_1            nice
  216.  
  217. # spamassassin@davidgreenaway.com (David Greenaway)
  218. body     FORGOTTEN_PASSWORD     /[fF]org[oe]t.{0,25}[pP]assword/
  219. describe FORGOTTEN_PASSWORD     Contains a password retrieval system
  220. tflags   FORGOTTEN_PASSWORD     nice
  221.  
  222.  
  223. ###########################################################################
  224. # meta compensation tests
  225. ###########################################################################
  226.  
  227. header __EVITE_CTYPE        Content-Type =~ /(?:multipart\/alternative|text\/(?:plain|html));/
  228. header __EVITE_RCVD        Received =~ /\b(?:evite|evt\S*\.citysearch)\.com/
  229. uri __EVITE_URI            /\bevite(?:\.citysearch)?\.com\/.*iid=[A-Z]{20}/
  230. meta EVITE            ((__EVITE_RCVD && __EVITE_URI) || (__EVITE_CTYPE && (__EVITE_RCVD || __EVITE_URI)))
  231. describe EVITE            Message looks like an Evite
  232. tflags EVITE            nice
  233.  
  234. meta REPLY_WITH_QUOTES        ((IN_REP_TO + REFERENCES + EMAIL_ATTRIBUTION + QUOTED_EMAIL_TEXT) > 2)
  235. describe REPLY_WITH_QUOTES    Reply with quoted text
  236. tflags REPLY_WITH_QUOTES    nice
  237.  
  238. ###########################################################################
  239.  
  240. # Till now no spammer told me where he's working at :o)
  241. #   -- Malte
  242. # freqs:  2.273    0.383    3.416    0.10    1.00  HAS_ORGANIZATION
  243. header HAS_ORGANIZATION         exists:Organization
  244. describe HAS_ORGANIZATION       Where are you working at?
  245. tflags HAS_ORGANIZATION         nice
  246.  
  247. body HOTMAIL_FOOTER4            /Join the world's largest e-mail service with MSN Hotmail\./
  248. describe HOTMAIL_FOOTER4        Common footer for Hotmail
  249. tflags HOTMAIL_FOOTER4          nice
  250.  
  251. header MAILER_DAEMON            From =~ /^(?:Mail Delivery \w+ )?<?mailer.?daemon\@\S+>?(?: \(Mail Delivery \w+\))?$/i
  252. describe MAILER_DAEMON          From the Mailer-Daemon
  253. tflags MAILER_DAEMON            nice
  254.  
  255. header   FAILURE_NOTICE_1       Subject =~ /^(?:failure notice|returned mail:|Delivery Status Notification|Undeliverable:)/i
  256. describe FAILURE_NOTICE_1       Mailer daemon failure notice (1)
  257. tflags   FAILURE_NOTICE_1       nice
  258.  
  259. body     FAILURE_NOTICE_2       /\b(?:Delivery to the following recipients failed|This Message was undeliverable|The following addresses had permanent fatal errors|did not reach the following recipient)\b/i
  260. describe FAILURE_NOTICE_2       Mailer daemon failure notice (2)
  261. tflags   FAILURE_NOTICE_2       nice
  262.  
  263. header FWD_MSG                  Subject =~ /Fwd:\s/
  264. describe FWD_MSG                Forwarded email
  265. tflags FWD_MSG                  nice
  266. test FWD_MSG ok Subject: Fwd: Dracula
  267. test FWD_MSG ok Subject: [landho] Fwd: tell rod
  268. test FWD_MSG fail Subject: Fwd:Pure Opt-In for half the price
  269. test FWD_MSG fail Subject: Re: RE: FWD: search results        .       .       .
  270.  
  271. header __ORIG_MESSAGE_AGENT    X-Mailer =~ /\b(?:Microsoft Outlook|Internet Mail Service|Mozilla|AOL)\b/
  272. rawbody __ORIG_MESSAGE_LINE    /^-{5,8} ?Original Message ?-{5,8}$/
  273. meta ORIGINAL_MESSAGE        (__ORIG_MESSAGE_AGENT && __ORIG_MESSAGE_LINE)
  274. describe ORIGINAL_MESSAGE    Looks like a reply to a message
  275. tflags ORIGINAL_MESSAGE        nice
  276.  
  277. #  3.351   0.0060   4.5117    0.001   0.97   -1.00  T_MSGID_GOOD_EXCHANGE
  278. header MSGID_GOOD_EXCHANGE    Message-Id =~ /^<[A-Z]{28}\.\S+\@\S+>$/
  279. describe MSGID_GOOD_EXCHANGE    Message-Id indicates the message was sent from MS Exchange
  280. tflags MSGID_GOOD_EXCHANGE    nice
  281.  
  282. # mailman list reminder mails are getting tagged in 2.41, adding a rule to check for these
  283. header __FROM_MAILMAN_OWNER     From:addr =~ /^mailman-owner@/
  284. header __SUBJECT_MAILMAN_REMIND Subject =~ /\bmailing list memberships reminder\b/
  285. meta MAILMAN_REMINDER        (__FROM_MAILMAN_OWNER && __SUBJECT_MAILMAN_REMIND)
  286. describe MAILMAN_REMINDER    Mail headers indicate a mailman membership reminder
  287. tflags MAILMAN_REMINDER        nice
  288.  
  289.